package StudyCode.summary.mydatetime;

import java.util.Calendar;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CalendarAddOrSubtractHour {
	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		System.out.println("当前时间 : " + calendar.get(Calendar.HOUR) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND));

		calendar.add(Calendar.HOUR, 1);

		System.out.println("加一小时后 : " + calendar.get(Calendar.HOUR) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND));

		calendar = Calendar.getInstance();
		calendar.add(Calendar.HOUR, -10);

		System.out.println("减去10小时后 : " + calendar.get(Calendar.HOUR) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND));

	}
}
